<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <title>欢迎页面-X-admin2.0</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi"/>
    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon"/>
    <link rel="stylesheet" href="/static/css/font.css">
    <link rel="stylesheet" href="/static/css/xadmin.css">
    <script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
    <script type="text/javascript" src="/static/lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="/static/js/xadmin.js"></script>
    <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
    <!--[if lt IE 9]>
    <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
    <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>

<body>
<div class="x-nav">
      <span class="layui-breadcrumb">
        <a href="">首页</a>
        <a href="">系统管理</a>
        <a>
          <cite>日志管理</cite></a>
      </span>
    <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right"
       href="javascript:refresh();" title="刷新">
        <i class="layui-icon" style="line-height:30px">ဂ</i></a>
</div>
<div class="x-body">
    <div class="layui-row" style="display: none">
        <form class="layui-form layui-col-md12 x-so layui-form-pane">
            <input class="layui-input" placeholder="菜单名" name="cate_name">
            <button class="layui-btn" lay-submit="" lay-filter="search">
                搜索
            </button>
        </form>
    </div>
    <xblock>
        <button class="layui-btn" onclick="javascript:layer.alert('♪(･ω･)ﾉ 我就是卖萌的,你敢信?!')"><i class="layui-icon"></i>新增</button>
        <button class="layui-btn" onclick="doTest()"><i class="layui-icon"></i>test</button>
        <span class="x-right" style="line-height:40px;display: none">共有数据：88 条</span>
    </xblock>


    <table class="layui-hide" id="menulist" lay-filter="opera"></table>


</div>

<script>
    function doTest() {
        $.get("/admin/log/user/list?page=1",function (json) {
            console.log(json)
        })
    }
    layui.use('table', function () {
        var table = layui.table
                , form = layui.form;
        table.render({
            elem: '#menulist',
            url: '/admin/log/user/list',
            page: { //支持传入 laypage 组件的所有参数（某些参数除外，如：jump/elem） - 详见文档
                layout: ['limit', 'count', 'prev', 'page', 'next', 'skip'], //自定义分页布局
                first: true, //不显示首页
                last: true //不显示尾页
            },
            cols: [[
//                {type: 'numbers'},
//                {type: 'checkbox'},
                {field: 'logname', title: '用户', templet: '#usernameTpl'},
                {field: 'logip', title: 'IP地址', width: 200, unresize: true, sort: true},
                {field: 'logtype', title: '类型', minWidth: 120, templet:function (d) {
                    switch (d['logtype']){
                        case 1:
                            return "登录请求";
                        case 2:
                            return "操作请求";
                        default:
                            return "未知请求";
                    }
                }},
                {field: 'issuccess', title: '请求结果', minWidth: 120, templet:function (d) {
                    return d['issuccess'] ? "成功" :"失败";
                }},
                {field: 'createtime', title: '时间',templet:templetCreatetime}
            ]],
            request: {
                pageName: 'page', //页码的参数名称，默认：page
                limitName: 'rows' //每页数据量的参数名，默认：limit
            }
        });
    });

</script>

</body>

</html>